package com.hsq.spzx.pay.configuration;

import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import com.hsq.spzx.pay.properties.AlipayProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author hsq
 * @date 2025-06-16 下午9:58
 */
@Configuration
public class AlipayConfiguration {
    @Autowired
    private AlipayProperties alipayProperties;

    @Bean
    public AlipayClient getAlipayClient() {
        AlipayClient alipayClient = new DefaultAlipayClient(
                alipayProperties.getAlipayUrl() ,
                alipayProperties.getAppId() ,
                alipayProperties.getAppPrivateKey() ,
                AlipayProperties.format ,
                AlipayProperties.charset ,
                alipayProperties.getAlipayPublicKey() ,
                AlipayProperties.sign_type );
        return alipayClient;
    }
}
